
package edu.chalmers.AV_2DPlatformerFramework.Control;

import edu.chalmers.AV_2DPlatformerFramework.Model.Game;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * Primitive mouse listener. Keeps track of mouse location and LMB pressed/released.
 * @version 0.0
 * @author Richard
 * @revised Richard, 2014-08-18 public constructor.
 */
public class MListener implements MouseListener{
    
    private int xPos;
    private int yPos;
    private boolean isPressed;
    private final Game game;

    public MListener(Game game) {
        this.game = game;
    }

    public void mouseClicked(MouseEvent e) {
        //not used
    }

    public void mousePressed(MouseEvent e) {
        xPos = e.getX();
        yPos = e.getY();
        isPressed = true;
    }

    public void mouseReleased(MouseEvent e) {
        xPos = e.getX();
        yPos = e.getY();
        isPressed = false;
    }

    public void mouseEntered(MouseEvent e) {
        //not used
    }

    public void mouseExited(MouseEvent e) {
        //not used
    }
    
    public int getMouseX(){
        return xPos;
    }
    public int getMouseY(){
        return yPos;
    }
    public boolean isPressed(){
        return isPressed;
    }
    public boolean isReleased(){
        return !isPressed;
    }
}
